// pages/editInfo/editInfo.js
var app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },
  chooseImg:function(){
    var that = this;
    wx.chooseImage({
      count: 1,
      sizeType: ['compressed'],
      sourceType: ['album', 'camera'],
      success(res) {
        const tempFilePaths = res.tempFilePaths
        console.log(tempFilePaths)
        wx.uploadFile({
          url: app.siteInfo.managerpath+'upload',
          filePath: tempFilePaths[0],
          name: 'file',
          formData:{
            pid: app.siteInfo.pid,
            mid:app.siteInfo.mid,
          },
          header: {
            "Content-Type": "multipart/form-data"
          },
          success: function (res) { 
            that.setData({
              headImg: res.data,
            })
          }
        })
        
      }
    })
  },
  topath:function(e){
    var that = this;
    var path = e.currentTarget.dataset.url;
    if(path == ''){
      wx.showToast({
        title: '功能尚未开通，敬请期待。',
        icon:'none',
      })
    }else{
      wx.navigateTo({
        url: path,
      })
    }
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var that = this;
    wx.request({
      url: app.siteInfo.managerpath + 'getManagerInfo',
      method: "post",
      data: {
        mid: app.siteInfo.mid,
        pid: app.siteInfo.pid,
        action: 'look',
      },
      success: function (res) {
        that.setData({
          logo:res.data.logo
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})